#pragma once
#include "textreader.h"
#include "GMFModel.h"
#include "GMFPlayerStart.h"
#include <map>
#include <vector>

enum SBXSTATE{MODEL,MAIN};

class SBXReader :
	public TextReader
{
public:
	SBXReader(wstring filename);
	virtual ~SBXReader(void);
	
	bool Read();

	std::vector<GMFModel*>::const_iterator GetModelBegin(){
		return m_Models.begin();
	}

	std::vector<GMFModel*>::const_iterator GetModelEnd(){
		return m_Models.end();
	}

	GMFPlayerStart* GetPlayerStart(){
		return m_PlayerStart;
	}

	DAEFloat3 GetCameraPosition(){
		return m_CameraPos;
	}

	DAEFloat3 GetCameraRotation(){
		return m_CameraRot;
	}
private:
	std::map<wstring,wstring> m_Properties;
	std::vector<GMFModel*> m_Models; 
	GMFPlayerStart* m_PlayerStart;

	DAEFloat3 m_CameraPos;
	DAEFloat3 m_CameraRot;

	SBXSTATE m_CurrentState;
	std::map<wstring,wstring> m_CurrentProperties;
	bool ModelHasProperty(wstring key);
	wstring GetModelProperty(wstring key);

	bool LevelHasProperty(wstring key);
	wstring GetLevelProperty(wstring key);
	void ParseSBXFloat3(wstring& toParse, float* x, float* y, float* z);
	void ReadModel();
	// -------------------------
	// Disabling default copy constructor and default assignment operator.
	// If you get a linker error from one of these functions, your class is internally trying to use them. This is
	// an error in your class, these declarations are deliberately made without implementation because they should never be used.
	// -------------------------
	SBXReader(const SBXReader& t);
	SBXReader& operator=(const SBXReader& t);
};

